import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {1


    public static List<Character> func(String s1,String s2) {
        List<Character> list = new ArrayList<>();
        for(int i = 0;i<s1.length();i++){
            char tem = s1.charAt(i);
            for(int j = 0;j<s2.length();j++){
                if(tem==s2.charAt(j)){
                    break;
                }else{
                    list.add(tem);
                }
            }
        }
        return list;
    }




        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            int num = scanner.nextInt();
            int target = scanner.nextInt();
            int[] array = new int[num];
            for (int i = 0; i < num; i++) {
                array[i] = scanner.nextInt();
            }
            int right = num - 1;
            int left = 0;
            int min = 0;
            int targrtIndex = -1;
            while(right>=left){
                min = (left+right)/2;
                if(array[min]>=target){
                    targrtIndex = min;
                    right = min-1;
                }
                if(array[min]<target){
                    left = min+1;
                }

            }
            if(targrtIndex>=0){
                System.out.println(targrtIndex);
            }else if(target>array[num-1]){
                System.out.println(-1);
            }else
            {
                System.out.println(min);
            }
        }
    
    public static void main4(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        int target = scanner.nextInt();
        int[] array = new int[num];
        for(int i = 0;i<num;i++){
            array[i] = scanner.nextInt();
        }
        int right = num-1;
        int left = 0;
        int min = 0;
        boolean t = false;
        while(right>left){
            min = (right+left)/2;
            if(array[min]>target){
                right = min-1;
            } else if(array[min]<target){
                left = min+1;
            }else{
                t = true;
                break;
            }
        }
        if(t){
            do{
                min = min-1;
            }while(array[min]==target);
            System.out.println(min+1);
        }else{
            System.out.println(-1);
        }
    }

    public static void main3(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        int[] array = new int[num];
        for(int i = 0;i<num;i++){
            array[i] = scanner.nextInt();
        }
        for(int i = 0;i<num-1;i++){
            for(int j = i;j>=0 && array[j]>array[j+1];j--){
                int tem = array[j];
                array[j] = array[j+1];
                array[j+1] = tem;
            }
        }
        for(int i = 0;i<num;i++){
            System.out.print(array[i]+" ");
        }
    }

    public static void main2(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int num = scanner.nextInt();
        int[] array = new int[num];
        for(int i = 0;i<num;i++){
            array[i] = scanner.nextInt();
        }
        int minIndex = 0;
        for(int i = 0;i<num-1;i++){
            minIndex = i;
            for(int j = i;j<num;j++){
                minIndex = array[minIndex]<array[j]?minIndex:j;
            }
            int tem = array[i];
            array[i] = array[minIndex];
            array[minIndex] = tem;
        }
        for(int i = 0;i<num;i++){
            System.out.print(array[i]+" ");
        }

    }
    public static void main1(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        StringBuilder newnode = new StringBuilder();
        for(int i = 0;i<str.length();i++){
            if(str.charAt(i)>='A'&&str.charAt(i)<='Z'){
               char tem = str.charAt(i);
               if(tem!='Z'){
                   newnode.append((char)(tem+33));
               }else if(tem=='Z')
                   newnode.append('a');
            }
            if(str.charAt(i)>='0'&&str.charAt(i)<='9'){
                newnode.append(str.charAt(i));
            }
            if(str.charAt(i)>='a'&&str.charAt(i)<='z'){
                char tem = str.charAt(i);
                switch(tem)
                {
                    case 'a':
                    case 'b':
                    case 'c':
                        newnode.append(2);
                        break;
                    case 'd':
                    case 'e':
                    case 'f':
                        newnode.append(3);
                        break;
                    case 'g':
                    case 'h':
                    case 'i':
                        newnode.append(4);
                        break;
                        case 'j':
                    case 'k':
                    case 'l':
                        newnode.append(5);
                        break;
                    case 'm':
                    case 'n':
                    case 'o':
                        newnode.append(6);
                        break; case 'q':
                    case 'p':
                    case 'r':
                    case 's':
                        newnode.append(7);
                        break; case 't':
                    case 'u':
                    case 'v':
                        newnode.append(8);
                        break; case 'w':
                    case 'x':
                    case 'y':
                    case 'z':
                        newnode.append(9);
                        break;

                }
            }
        }
        System.out.println(newnode.toString());

    }
}
